package Enums;

public enum DestroyalType {
	CELLAR(0),
	BOTTLES_AND_CANS(1),
    KEGS(2),
    FIRKINS(3),
    BARRELS(4);
    
    private int type;

    DestroyalType(final int type) {
            this.type = type;
    }

    public int getType() {
            return type;
    }

    public static DestroyalType getType(final String type) {
            return getType(Integer.parseInt(type));
    }
    
    public static DestroyalType getType(final int type) {
        switch (type) {
        case 0:
            return CELLAR;
        case 1:
            return BOTTLES_AND_CANS;
        case 2:
            return KEGS;
        case 3:
            return FIRKINS;
        case 4:
            return BARRELS;
        default:
            throw new EnumConstantNotPresentException(LabResult.class, String.valueOf(type));
        }
    }
    
    public static int getTypeByName(final String str) {
        if(str.equals("CELLAR")){
            return 0;
        } else if(str.equals("BOTTLES_AND_CANS")){
            return 1;
        } else if(str.equals("KEGS")){
            return 2;
        } else if(str.equals("FIRKINS")){
            return 3;
        } else if(str.equals("BARRELS")){
            return 4;
        } else {
            return 0;
        }
    }
    
    public static String getTypeDescription(final int type) {
        switch (type) {
            case 0:
                return "Destroy Cellaring Beer";
            case 1:
                return "Destroy Packaged Beer";
            case 2:
                return "Destroy Kegged Beer";
            case 3:
                return "Destroy Barreled Beer";
            case 4:
                return "Destroy Firkin Beer";
            default:
                throw new EnumConstantNotPresentException(LabResult.class, String.valueOf(type));
        }
    }
    
    public static int getTypeByDescription(final String str) {
        if(str.equals("Destroy Cellaring Beer")){
            return 0;
        } else if(str.equals("Destroy Packaged Beer")){
            return 1;
        } else if(str.equals("Destroy Kegged Beer")){
            return 2;
        } else if(str.equals("Destroy Barreled Beer")){
            return 3;
        } else if(str.equals("Destroy Firkin Beer")){
            return 4;
        } else {
            return 0;
        }
    }
}
